package com.zzxz.practicaltrainingsys.service.impl;

import com.zzxz.practicaltrainingsys.entity.Grade;
import com.zzxz.practicaltrainingsys.mapper.GradeMapper;
import com.zzxz.practicaltrainingsys.service.GradeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GradeServiceImpl implements GradeService {
    @Autowired
    private GradeMapper gradeMapper;

    @Override
    public List<Grade> getGrade() {
        return gradeMapper.getGrade();
    }

    @Override
    public boolean addGrade(Grade grade) {
        return gradeMapper.addGrade(grade) > 0;
    }

    @Override
    public Grade getGradeById(Integer grade_id) {
        return gradeMapper.getGradeById(grade_id);
    }

    @Override
    public int updateGrade(Grade grade) {
        return gradeMapper.updateGrade(grade);
    }

    @Override
    public List<Grade> getGradeByMajorId(Integer major_id) {
       return gradeMapper.getGradeByMajorId(major_id);
    }
}